import  request  from "@/utils/request";

//类型1:请求一级列表 返回单个分类类型
export interface OneCategory1 {
    id:number,
    name:string
}
//类型2:请求一级列表 返回值数组类型
export type Category1SelectorList = OneCategory1[]
//类型3:请求二级列表 返回的单个数据
export interface OneCategory2 extends OneCategory1 {
    category1Id:number
}
//类型4:请求二级列表 返回值数组类型
export type Category2SelectorList = OneCategory2[]
//类型5:请求三级列表 返回的单个数据
export interface OneCategory3 extends OneCategory1 {
    category3Id:number
}
//类型6:请求三级列表 返回值数组类型
export type Category3SelectorList = OneCategory3[]

//请求1:请求一级列表
export const requestCategory1Selector = ()=>{
    return request.get<any,Category1SelectorList>(`/product/getCategory1`)
}
//请求2:请求二级分类列表
export const requestCategory2Selector = (category1Id:number)=>{
    return request.get<any,Category2SelectorList>(`/product/getCategory2/${category1Id}`)
}
//请求3:请求三级分类列表
export const requestCategory3Selector = (category2Id:number)=>{
    return request.get<any,Category3SelectorList>(`/product/getCategory3/${category2Id}`)
}
